package org.uk.splitsbrowser.client.view;

import com.google.gwt.user.client.ui.DialogBox;

/**
 * Dialog box that informs the user that an unexpected server error has occurred
 */
public class ServerErrorDialog extends DialogBox {

	private static final String SERVER_ERROR = "An error occurred while "
			+ "attempting to contact the server. Please check your network "
			+ "connection and try again.";
	
	private DialogBox dialog;
	
	ServerErrorDialog() {
		
		dialog = new DialogBox();
		// Show the RPC error message to the user
		dialog.setText("Remote Procedure Call - Failure");
		dialog.addStyleName("serverResponseLabelError");
		dialog.setHTML(SERVER_ERROR);
		dialog.center();
		dialog.setGlassEnabled(true);
		dialog.setModal(true);
	}
	
	public void show(String message) {
		dialog.setHTML(SERVER_ERROR.concat(message));
		dialog.show();
	}

}
